#pragma once
#include"RedBlack.h"


namespace Abert
{
	template<class K>
	class set
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:
		typedef typename RBTree<K, K, SetKeyOfT>::iterator iterator;

		iterator begin()
		{
			return _s.begin();
		}

		iterator end()
		{
			return _s.end();
		}

		pair<iterator, bool> Insert(const K& key)
		{
			return _s.Insert(key);
		}


	private:
		RBTree<K, K, SetKeyOfT> _s;

	};

	void test_set()
	{
		set<int> s;

		set<int>::iterator it = s.begin();
		while (it != s.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;

		s.Insert(3);
		s.Insert(2);
		s.Insert(1);
		s.Insert(5);
		s.Insert(3);
		s.Insert(6);
		s.Insert(4);
		s.Insert(9);
		s.Insert(7);


		it = s.begin();
		while (it != s.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;
	}
}